<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="" method="post" enctype="multipart/form-data">
        <input type="text" name="name" id="txtName"><br>
        <input type="text" name="skill" id="txtSkill"><br>
        <input type="file" name="icon" id="fileIcon"><br>
        <input id="btnUp" ,type="button" value="上传"><br>
    </form>
</body>
<script src="./js/jquery.js"></script>
<script>
    $('#btnUp').click(function () {
        // 使用formdata封装表单数据（包含了文本框和文件框）
        let fd = new FormData($('form')[0])
        // 使用jqeury异步提交
        $.ajax({
            url: '/upfile',
            method: 'post',
            data: fd,
            processData: false,
            contentType: false,
            success(backdata) {
                console.log(backdata)
            }
        })
    })

</script>

</html>